package com.xue.controller;

import java.util.List;
import java.util.Map;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import com.alibaba.fastjson.JSON;
import com.xue.bean.Product;
import com.xue.service.ISkillService;

@RestController
public class ClientSkillController {
	
	
	@Value("${server.port}")
	private String port;

	@Autowired
	ISkillService skillService;
	
	@RequestMapping(value = "/userShop")
	public String sayHi( Product pro , String userId){
		
		List<Map<String,String>> list = skillService.skillShop(pro, userId);
		String rtnStr = JSON.toJSONString(list);
		
		System.err.println("***底层接口执行： **********"+port+"****************");
//		ExecutorService cachedThreadPool = Executors.newCachedThreadPool();
//      	cachedThreadPool.execute(new Runnable(){
//			@Override
//			public void run() {
//				System.out.println("***********进入线程执行*************");
//            	
//				List<Map<String,String>> list = skillService.skillShop(pro, userId);
//				//String rtnStr = JSON.toJSONString(list);
//			}	        	   
//         });  //创建 n 个线程。
//		 cachedThreadPool.shutdown(); 
		return rtnStr;
	}
	 
	
}
